import base_url from './config.js'

// 箭头函数
const urlFormat = (url,w,h) => { // urlFormat(98,100)
	if(!url){
		if(w && h){
			console.log(`https://iph.href.lu/${w}x${h}`);
			return `https://iph.href.lu/${w}x${h}`;
		}else{
			return '';
		}
	}else{
		// let regEx = /^(http|https):\/\/[\w.]*$/i
		let regEx = /^(http|https):\/\//i
		// console.log(regEx.test(url));
		if(regEx.test(url)){
			return url;
		}else{
			return base_url + url;
		}
	}
}

export {
	urlFormat
}